from mpi4py import MPI
comm = MPI.COMM_WORLD
size = comm.Get_size()
if size != 5:
    print("Error: This program must run with 5 processes")
else:
    print("Success!")

# exit in root node
if comm.rank == 0:
    comm.Abort()

